//
//  NSData+Transition.m
//  SoQu
//
//  Created by Seven on 2018/9/19.
//  Copyright © 2018年 Seven. All rights reserved.
//

#import "NSData+Transition.h"

@implementation NSData (Transition)
+ (NSArray *)arrayFromData:(NSData *)data {
    
    id jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
    
    return (NSArray *)jsonObject;
}
+ (NSString *)stringFromData:(NSData *)data {
    return [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
}

+ (NSData *)arrayToData:(NSArray *)array {
    return [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:nil];
}
+ (NSData *)stringToData:(NSString *)string {
    return [string dataUsingEncoding: NSUTF8StringEncoding];
}
@end
